package com.atguigu.tingshu.user.client;


import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.user.VipServiceConfig;
import com.atguigu.tingshu.user.client.impl.UserDegradeFeignClient;
import com.atguigu.tingshu.vo.user.UserInfoVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 产品列表API接口
 * </p>
 *
 * @author atguigu
 */
@FeignClient(value = "service-user", fallback = UserDegradeFeignClient.class)
public interface UserFeignClient {


    /**
     * 更新Vip到期失效状态
     *
     * @return
     */
    @GetMapping("updateVipExpireStatus")
    public Result updateVipExpireStatus();

    /**
     * 根据用户id获取用户信息
     * /api/user/userInfo/getUserInfoVo/{userId}
     */
    @GetMapping("/api/user/userInfo/getUserInfoVo/{userId}")
    public Result<UserInfoVo> getUserInfoVo(@PathVariable Long userId);

    /**
     * 获取专辑声音列表某页中，用户对于声音付费情况
     *
     * @param userId
     * @param albumId
     * @param trackIdList
     * @return
     */
    @PostMapping("/api/user/userInfo/userIsPaidTrack/{userId}/{albumId}")
    public Result<Map<Long, Integer>> userIsPaidTrackList(@PathVariable Long userId, @PathVariable Long albumId,
                                                          @RequestBody List<Long> trackIdList);


    /**
     * 判断用户是否购买过指定专辑
     *
     * @param albumId
     * @return
     */
    @GetMapping("/api/user/userInfo/isPaidAlbum/{albumId}")
    public Result<Boolean> isPaidAlbum(@PathVariable Long albumId);


    /**
     * 根据id获取VIP的用户配置信息
     * /api/user/vipServiceConfig/getVipServiceConfig/{id}
     */
    @GetMapping("/api/user/vipServiceConfig/getVipServiceConfig/{id}")
    public Result<VipServiceConfig> getVipServiceConfig(@PathVariable Long id);


    /**
     * 根据专辑id+用户ID获取用户已购买声音id列表
     *
     * @param albumId
     * @return
     */
    @GetMapping("/api/user/userInfo/findUserPaidTrackList/{albumId}")
    public Result<List<Long>> getUserPaidTrackList(@PathVariable Long albumId);
}
